home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8477 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  41 lines

  1. Newsgroups: comp.lang.c
  2. Path: uu4news.netcom.com!friend!news
  3. From: rich@kastle.com (Richard Krehbiel)
  4. Subject: Re: realloc(NULL,100)
  5. Message-ID: <1996Mar4.153550.21003@friend.kastle.com>
  6. Sender: news@friend.kastle.com (News)
  7. Reply-To: rich@kastle.com
  8. Organization: Kastle Development Associates
  9. X-Newsreader: Forte Free Agent 1.0.82
  10. References: <31346CB0.41C67EA6@jupiter.di.uminho.pt> <TANMOY.96Feb28151825@qcd.lanl.gov> <1996Mar4.122207.16986@friend.kastle.com>
  11. Date: Mon, 4 Mar 1996 15:36:57 GMT
  12.  
  13. rich@kastle.com (Richard Krehbiel) wrote:
  14.  
  15. ...a typo.  Whoops.  That's what I get for not rigorously testing my
  16. (admittedly silly) postings.  I should be flogged unto senselessness.
  17.  
  18. >#include <stdio.h>
  19. >#include <stdlib.h>
  20.  
  21. >int main(void)
  22. >{
  23. >   void *p;
  24. >   int i;
  25.  
  26. >   /* Try really hard, up to 100 times, to get the memory
  27. >      I desparately need */
  28. >   for(i = 0, p = NULL; p != NULL && i < 100; i++)
  29.                          --------- (that should say p == NULL)
  30.  
  31. >      p = malloc(100);
  32.  
  33. >   return p ? EXIT_SUCCESS : EXIT_FAILURE;
  34. >}
  35.  
  36.  
  37. --
  38. Richard Krehbiel, Kastle Systems, Arlington VA USA
  39. rich@kastle.com (work) or richk@mnsinc.com (personal)
  40.  
  41.